package com.chixing.dao.mapper;

import com.chixing.pojo.Department;

import java.sql.ResultSet;
import java.sql.SQLException;

public class DepartmentRowMapper implements RowMapper<Department>{
    @Override
    public Department mapper(ResultSet rs) {
        try {
            if (rs.next()) {

                int deptno = rs.getInt(1);   // 10
                String deptName = rs.getString(2); // 财务部
                String deptLoc = rs.getString(3); //苏州

                Department   department = new Department(deptno, deptName, deptLoc);
                System.out.println("mapper dept :" + department);
                return department;
            }
        }catch (SQLException e){
            e.fillInStackTrace();
        }
        return null;
    }
}
